﻿<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="seeion.asp"--> 
<%
title=request.form("title")
etitle=request.form("etitle")
body=request.form("body")
ebody=request.form("ebody")

'
'response.write (onTop)
'response.end

if request("type") = "add" then
	set rs=server.createobject("adodb.recordset")
	sql="select title,etitle,body,ebody,UpdateTime from doings"
	rs.open sql,conn,1,3
	call panduan()
	rs.addnew
	rs("title")=title
	rs("etitle")=etitle
	rs("body")=body
	rs("ebody")=ebody
	rs("UpdateTime")=now()
	rs.update
	Response.Write "<script>alert('添加活动成功！点击 [确定] 继续添加！');window.location.href='admin_doings.asp';</script>" 
else
	sql="select title,etitle,body,ebody,UpdateTime from doings where id="&request("id")&""
	set rs=server.createobject("adodb.recordset")
	rs.open SQL,conn,2,3
	if rs.eof and rs.bof then
		Response.Write "<script language='javascript'>alert('参数错误!');document.location.href('Manage_doings.asp');</script>"
		Response.End()
	end if
	call panduan()
	rs("title")=title
	rs("etitle")=etitle
	rs("body")=body
	rs("ebody")=ebody
	rs("UpdateTime")=now()
	rs.update 
	response.write "<script>alert('修改活动成功！点击 [确定] 返回新闻管理');window.location.href='admin_doings.asp?type=update&id="&request("id")&"';</script>" 
end if
rs.close
set rs=nothing
conn.close
set rs=nothing

function panduan()
	if title=""  then 
		response.Write("<script language=javascript>alert('中文活动名称不能为空!');history.go(-1)</script>") 
		response.end 
	end if
	if body="" then 
		response.Write("<script language=javascript>alert('中文活动名称不能为空!');history.go(-1)</script>") 
		response.end 
	end if
end function
%>
